﻿using System.Collections.Generic;
using UnityEngine;

namespace Configs
{
    /// <summary>
    ///     技能范围
    /// </summary>
    public struct SkillRange
    {
        public Vector2 Rect;
        public float Radius;

        public SkillRange(Vector2 rect = default, float radius = 0.0f)
        {
            Rect = rect;
            Radius = radius;
        }
    }

    /// <summary>
    ///     技能属性
    /// </summary>
    public struct SkillAttr
    {
        public float Cd;

        /// <summary>
        ///     攻击力 0~1 百分比
        /// </summary>
        public float Atk;

        /// <summary>
        ///     mp 消耗
        /// </summary>
        public float Mp;
    }

    /// <summary>
    ///     技能数据
    /// </summary>
    public struct SkillData
    {
        /// <summary>
        ///     id
        /// </summary>
        public int Id;

        /// <summary>
        ///     技能名
        /// </summary>
        public string Name;

        /// <summary>
        ///     技能描述
        /// </summary>
        public string Desc;

        /// <summary>
        ///     技能图标
        /// </summary>
        public string Img;

        /// <summary>
        ///     技能范围
        /// </summary>
        public SkillRange Range;

        /// <summary>
        ///     技能属性
        /// </summary>
        public SkillAttr Attr;

        /// <summary>
        ///     技能当前 Cd
        /// </summary>
        public float Cd;
    }

    /// <summary>
    ///     技能配置
    /// </summary>
    public static class SkillConfig
    {
        public static Dictionary<int, SkillData> SkillDatas = new()
        {
            [101] = new SkillData
            {
                Id = 101,
                Name = "技能1",
                Desc = "技能描述1",
                Img = "GUI_parts/Icons/skill_icon_01",
                Range = new SkillRange(new Vector2(1.0f, 16.0f)),
                Attr = new SkillAttr
                {
                    Cd = 1.0f,
                    Atk = 1,
                    Mp = 10
                }
            },
            [102] = new SkillData
            {
                Id = 102,
                Name = "技能2",
                Desc = "技能描述2",
                Img = "GUI_parts/Icons/skill_icon_02",
                Range = new SkillRange(default, 6.0f),
                Attr = new SkillAttr
                {
                    Cd = 2.0f,
                    Atk = 2,
                    Mp = 20
                }
            },
            [103] = new SkillData
            {
                Id = 103,
                Name = "技能3",
                Desc = "技能描述3",
                Img = "GUI_parts/Icons/skill_icon_03",
                Range = new SkillRange(default, 8.0f),
                Attr = new SkillAttr
                {
                    Cd = 3.0f,
                    Atk = 33,
                    Mp = 30
                }
            },
            [104] = new SkillData
            {
                Id = 104,
                Name = "技能4",
                Desc = "技能描述4",
                Img = "GUI_parts/Icons/skill_icon_04",
                Range = new SkillRange(default, 10.0f),
                Attr = new SkillAttr
                {
                    Cd = 4.0f,
                    Atk = 4,
                    Mp = 40
                }
            }
        };
    }
}